<center><div id="divConTrailer">
<table>
<tr><th colspan="3" style="font-size:14px">Related Videos</th></tr>
	<tr>
    	<td><img onclick="gotoNBTrailer(-1)" style="cursor:pointer" src="wp-content/themes/theme1273/images/prettyPhoto/facebook/btnPrevious.png"  /></td>
        <td id="trailerContent"></td>
        <td><img onclick="gotoNBTrailer(1)" style="cursor:pointer" src="wp-content/themes/theme1273/images/prettyPhoto/facebook/btnNext.png"  /></td>
    </tr>
</table>
</div></center>
<?php 

if ( isset ($_GET['id']) )
	$id=substr($_GET['id'],2,8);
else if ( isset ($_GET['idCs']) )
	$id='0000000';

$content = '';
$trailers = @simplexml_load_string( file_get_contents ('http://api.traileraddict.com/?imdb='.$id.'&count=4&width=350') );
for($i=0;$i<4;$i++){
	if(isset($trailers->trailer[$i]->embed))
		$content .= "'".$trailers->trailer[$i]->embed."', ";
}
$content =substr($content,0, strlen( $content )-2 );
?>

<script type="text/javascript">
	currenTrailer = 0;
	var listaT = new Array( <?php echo $content; ?> );
	if(listaT.length > 0 )
		document.getElementById("trailerContent").innerHTML = listaT[0];
	else 
		document.getElementById("divConTrailer").innerHTML = '<h1 style="color:#FFF">Related Videos Not Available</h1>';
	
	function gotoNBTrailer ( input ){
		tmp = currenTrailer + input;
		if(tmp >=0 && tmp< listaT.length && listaT[tmp] != "undefined"){
			document.getElementById("trailerContent").innerHTML = listaT[tmp]
			currenTrailer = tmp;
		}
	}
	
</script>


